/*
 * 创建日期 2007-12-18
 * 
 * 更改所生成文件模板为 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
package com.ybfenpan.taglib;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.File;

/**
 * @author Administrator
 * 
 *         更改所生成类型注释的模板为 窗口 > 首选项 > Java > 代码生成 > 代码和注释
 */
public class ShowImageTag extends TagSupport {
    private String name;
    private String height = "150"; // 高度默认值(可在标签中重置)
    private String width = "290"; // 宽度默认值(可在标签中重置)

    /**
     * @return int
     * @throws JspException JspException
     */
    public int doStartTag() throws JspException {

        return SKIP_BODY;
    }

    /**
    * 找到目录下的所有文件，然后删除
    * @Title: deleteLastFile
    * @param file file
    * @author: Qiyh 2013-12-18
    */
    private void deleteLastFile(File file) {
        if (file.isDirectory()) {
            // 获得目录下的所有文件
            File[] f = file.listFiles();
            // 遍历所有文件
            for (int i = 0; i < f.length; i++) {
                File fi = f[i];
                long tong = fi.lastModified();
                long uid = System.currentTimeMillis();
                if (uid - tong > 50000) {
                    fi.delete();
                }
            }
        }
    }

    /**
    * @Title: getName
    * @return String
    * @author: Qiyh 2013-12-18
    */
    public String getName() {
        return name;
    }

    /**
    * @Title: setName
    * @param string string
    * @author: Qiyh 2013-12-18
    */
    public void setName(String string) {
        name = string;
    }

    /**
    * @Title: getHeight
    * @return String
    * @author: Qiyh 2013-12-18
    */
    public String getHeight() {
        return height;
    }

    /**
    * @Title: getWidth
    * @return String
    * @author: Qiyh 2013-12-18
    */
    public String getWidth() {
        return width;
    }

    /**
    * @Title: setHeight
    * @param string string
    * @author: Qiyh 2013-12-18
    */
    public void setHeight(String string) {
        height = string;
    }

    /**
    * @Title: setWidth
    * @param string string
    * @author: Qiyh 2013-12-18
    */
    public void setWidth(String string) {
        width = string;
    }

}
